package com.example.chat.chat.pojo.entity;

import com.baomidou.mybatisplus.annotation.*;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;

import java.io.Serial;
import java.io.Serializable;


import java.time.LocalDateTime;

@Data
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper=false)
@Builder
@NoArgsConstructor
@AllArgsConstructor
@TableName("scs_chat")
public class ChatEntity implements Serializable{

    @Serial
    private static final long serialVersionUID = 1L;

    public static final String ID = "id";
    public static final String REFERENCE_CHAT_ID = "reference_chat_id";
    public static final String SESSION_ID = "session_id";
    public static final String SENDER_ID = "sender_id";
    public static final String CONTENT = "content";
    public static final String STATUS = "status";
    public static final String CREATE_TIME = "create_time";
    public static final String UPDATE_TIME = "update_time";
    public static final String IS_DELETED = "is_deleted";

    /** 主键 */
    @TableId(value = ID, type = IdType.AUTO)
    private Long id;

    /** 引用聊天ID */
    @TableField(value = REFERENCE_CHAT_ID)
    private Long referenceChatId;

    /** 会话ID */
    @TableField(value = SESSION_ID)
    private Long sessionId;

    /** 发现发送者ID */
    @TableField(value = SENDER_ID)
    private Long senderId;

    /** 聊天内容 */
    @TableField(value = CONTENT)
    private String content;

    /** 状态：0-发送 1-已读 2-撤回 */
    @TableField(value = STATUS)
    private Integer status;

    /** 创建时间 */
    @TableField(value = CREATE_TIME, fill = FieldFill.INSERT)
    private LocalDateTime createTime;

    /** 更新时间 */
    @TableField(value = UPDATE_TIME, fill = FieldFill.UPDATE)
    private LocalDateTime updateTime;

    /** 是否软删：0-否，1-是 */
    @TableField(value = IS_DELETED)
    private Integer isDeleted;


}
